package com.sanjiahantang.youjiarole.module.me.quotation.beans;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.sanjiahantang.youjiarole.base.BaseBean;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by zy on 2017/11/15.
 */

public class ContractSignBean extends BaseBean {
    private String data;

    public Data getData() {
        return new Gson().fromJson(data,Data.class);
    }

    public void setData(String data) {
        this.data = data;
    }

    public static class Data{

        private String contractCode;
        private String designIdCode;
        private String isContractRegister;
        private String otherName;
        private int pcId;
        private String signer1;

        public static Data objectFromData(String str) {

            return new Gson().fromJson(str, Data.class);
        }

        public static Data objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), Data.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public static List<Data> arrayDataFromData(String str) {

            Type listType = new TypeToken<ArrayList<Data>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public static List<Data> arrayDataFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);
                Type listType = new TypeToken<ArrayList<Data>>() {
                }.getType();

                return new Gson().fromJson(jsonObject.getString(str), listType);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return new ArrayList();


        }

        public String getContractCode() {
            return contractCode;
        }

        public void setContractCode(String contractCode) {
            this.contractCode = contractCode;
        }

        public String getDesignIdCode() {
            return designIdCode;
        }

        public void setDesignIdCode(String designIdCode) {
            this.designIdCode = designIdCode;
        }

        public String getIsContractRegister() {
            return isContractRegister;
        }

        public void setIsContractRegister(String isContractRegister) {
            this.isContractRegister = isContractRegister;
        }

        public String getOtherName() {
            return otherName;
        }

        public void setOtherName(String otherName) {
            this.otherName = otherName;
        }

        public int getPcId() {
            return pcId;
        }

        public void setPcId(int pcId) {
            this.pcId = pcId;
        }

        public String getSigner1() {
            return signer1;
        }

        public void setSigner1(String signer1) {
            this.signer1 = signer1;
        }
    }
}
